package com.kifas.entity;

import java.io.Serializable;
import java.math.BigDecimal;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "tb_barang")
public class BarangEntity implements Serializable {

	private static final long serialVersionUID = 7139701975973392362L;

	@Id
	@GeneratedValue
	@Column(name = "id_barang")
	private Long idBarang;

	@Column(name = "kd_barang")
	private String kdBarang;

	@ManyToOne
	@JoinColumn(name = "id_jenis_barang", nullable = false)
	private JenisBarangEntity jenisBarang;

	@ManyToOne
	@JoinColumn(name = "id_satuan", nullable = false)
	private SatuanEntity satuan;

	private BigDecimal hargaBeli;

	private BigDecimal hargaJual;

	private String nama;
	
	@Column(name = "stok_minimal")
	private Long stokMinimal;

	@Column(name = "stok_maksimal")
	private Long stokMaksimal;
	
	@Column(name= "created_by")
	private String createdBy;

	public BarangEntity() {
	}

	public BarangEntity(Long idBarang, String kdBarang,
			JenisBarangEntity jenisBarang, SatuanEntity satuan, String nama,
			BigDecimal hargaBeli, BigDecimal hargaJual, String createdBy) {
		this.idBarang = idBarang;
		this.kdBarang = kdBarang;
		this.jenisBarang = jenisBarang;
		this.satuan = satuan;
		this.nama = nama;
		this.hargaBeli = hargaBeli;
		this.hargaJual = hargaJual;
		this.createdBy = createdBy;
	}
	
	public BarangEntity(Long idBarang, String kdBarang,
			JenisBarangEntity jenisBarang, SatuanEntity satuan, String nama,
			BigDecimal hargaBeli, BigDecimal hargaJual, 
			Long stokMinimal, Long stokMaksimal, String createdBy) {
		this.idBarang = idBarang;
		this.kdBarang = kdBarang;
		this.jenisBarang = jenisBarang;
		this.satuan = satuan;
		this.nama = nama;
		this.hargaBeli = hargaBeli;
		this.hargaJual = hargaJual;
		this.stokMinimal = stokMinimal;
		this.stokMaksimal = stokMaksimal;
		this.createdBy = createdBy;
	}

	public Long getIdBarang() {
		return idBarang;
	}

	public void setIdBarang(Long idBarang) {
		this.idBarang = idBarang;
	}

	public String getKdBarang() {
		return kdBarang;
	}

	public void setKdBarang(String kdBarang) {
		this.kdBarang = kdBarang;
	}

	public JenisBarangEntity getJenisBarang() {
		return jenisBarang;
	}

	public void setJenisBarang(JenisBarangEntity jenisBarang) {
		this.jenisBarang = jenisBarang;
	}

	public String getNama() {
		return nama;
	}

	public void setNama(String nama) {
		this.nama = nama;
	}

	public SatuanEntity getSatuan() {
		return satuan;
	}

	public void setSatuan(SatuanEntity satuan) {
		this.satuan = satuan;
	}

	public BigDecimal getHargaBeli() {
		return hargaBeli;
	}

	public void setHargaBeli(BigDecimal hargaBeli) {
		this.hargaBeli = hargaBeli;
	}

	public BigDecimal getHargaJual() {
		return hargaJual;
	}

	public void setHargaJual(BigDecimal hargaJual) {
		this.hargaJual = hargaJual;
	}

	public Long getStokMinimal() {
		return stokMinimal;
	}

	public void setStokMinimal(Long stokMinimal) {
		this.stokMinimal = stokMinimal;
	}

	public Long getStokMaksimal() {
		return stokMaksimal;
	}

	public void setStokMaksimal(Long stokMaksimal) {
		this.stokMaksimal = stokMaksimal;
	}

	public void setCreatedBy(String createdBy) {
		this.createdBy = createdBy;
	}

	public String getCreatedBy() {
		return createdBy;
	}
}
